package main

import (
	"bufio"
	"fmt"
	"os"
	"time"
)

func main() {
	// 心跳包
	ticker := time.NewTicker(time.Second * 1)
	i := 0
	go func() {
		for {
			fmt.Printf("heart beat. %d\n", i)
			i++
			<-ticker.C
		}
	}()
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		fmt.Println("echo: ", scanner.Text())
	}
}
